package org.joke.manager.model;

public class Snippet {
	public static int counter = 0;

	private String label;

	private int id;

	public Snippet() {
		counter++;
		setId(counter);
	}

	public Snippet(String value) {
		super();
		this.value = value;
		counter++;
		setId(counter);
	}

	private String value;

	public String getLabel() {
		if (value != null && value.length() > 20) {
			label = value.substring(0, 20);
			label = label.replaceAll("\r\n", "");
		} else {
			label = value;
		}
		return label;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	@Override
	public String toString() {
		return id + ") " + getLabel().trim();
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

}
